<script setup name="pageSet">
import { useRouter } from "vue-router";
import { ref } from "vue";
const router = useRouter();
const val = ref("页面一");
// 清除当前页面路由并且跳转到作品制作页面
const save = () => {
  router.replace("/works/add");
};
// 页面名称最多八个字，超出不显示
const inputVal = (msg) => {
  if (val.value.length >= 8) {
    val.value = msg.substring(0, 8);
  }
};
</script>

<template>
  <!-- 页面层级设置 -->
  <div class="container">
    <div class="container-item">
      <div class="container-item-id">
        <van-tag color="#EDFEF7" type="primary" size="medium">图片</van-tag>
        <input v-model="val" @input="inputVal(val)" />
      </div>

      <img src="@/assets//jh.png" alt="" />
    </div>
    <div class="container-item">
      <div class="container-item-id">
        <van-tag color="#EDFEF7" type="primary" size="medium">图片</van-tag>
        <input v-model="val" @input="inputVal(val)" />
      </div>

      <img src="@/assets//jh.png" alt="" />
    </div>
  </div>
  <button class="save" @click="save">保存</button>
</template>

<style lang="less" scoped>
.container {
  width: 100%;
  font-size: 26px;
  box-sizing: border-box;
  padding: 0 30px 0 29px;
  .container-item {
    width: 100%;

    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;

    .container-item-id {
      border-radius: 16px;
      background-color: #f8f8f8;
      flex: 1;
      height: 90px;
      line-height: 90px;
      box-sizing: border-box;
      padding-left: 20px;
      margin-right: 18px;
      :deep(.van-tag) {
        margin-right: 20px;
        border-radius: 10px;
        color: #666666;
      }
      input {
        background-color: #f8f8f8;
      }
    }
    img {
      width: 56px;
    }
  }
}

.save {
  position: fixed;
  bottom: 20px;
  left: 50%;
  margin-left: -345px;
  text-align: center;
  border-radius: 16px;
  width: 690px;
  height: 90px;
  background: linear-gradient(90deg, @start-btnbgc 0%, @end-btnbgc 100%);
  font-size: 28px;
  color: #000;
}
</style>
